<%@page import="java.util.ArrayList"%>
<%@page import="cn.sendto.service.CarInfoService"%>
<%@page import="cn.sendto.model.ParkInfoModel"%>
<%@page import="java.util.List"%>
<%@page import="cn.sendto.service.ParkInfoService"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" errorPage="../err.jsp"%>
	<jsp:include page="../lock.jsp"></jsp:include>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>教室信息表</title>
<style >
.txt20 {
	font-size: 20px;
}

.input {
	width: 60px;
	height: 25px;
}
a{
	text-decoration: none;
}
</style>
</head>
<body>
	<div class="txt20">当前位置-->教室信息表</div>
	<%
		request.setCharacterEncoding("UTF-8");
	
		ParkInfoService pis = new ParkInfoService();
		String select = request.getParameter("select");
		String type = request.getParameter("type");
	%>
	<form action="parklist.jsp" method="post">
	<span>搜索关键字：</span>&nbsp;
		<input type="text" name="select" placeholder="请输入要查询的关键字">
		类别： <select name="type">
			<option value="0" selected="selected">全部</option>
			<option value="1">良好</option>
			<option value="2">一般</option>
		</select> &nbsp;&nbsp;<input type="submit" name="查询" value="查询" class="input">
	</form>
	<div align="right" style="width:95%;font-size:25px;"><a href="addpark.jsp">添加教室</a></div>
	<div>
		<%
		if (request.getAttribute("parkinfo") != null) {
			out.print("<span style='color:red'>"+request.getAttribute("parkinfo")+"</span>");
		}
		List<ParkInfoModel> list = new ArrayList<ParkInfoModel>();
		 if (select == null  && type == null ) {
			list = pis.allPark();
			out.print("目前共有教室"+list.size()+"个");
		} 
		if (type != null && (select == null  || select.equals(""))) {
			list = pis.selecttype(type);
			out.print("查询到教室"+list.size()+"个");
		}else if(select != null && type != null ){
			list = pis.select(select, type);
			out.print("查询到教室"+list.size()+"个");
		}
		if(list.size() > 0){
		%>
		<table width="95%" class="txt12" style="background-color: #00BBEE"
			cellspacing="1" cellpadding="0">
			<tr style="background-color: #EEEEEE; height: 30px">
				<th>序号</th>
				<th>教室编号</th>
				<th>教室名称</th>
				<th>教室状态</th>
				<th>教室座位</th>
				<th>教室备注</th>
				<th>修改</th>
				<th>删除</th>
			</tr>
			<%
				for (int i = 0; i < list.size(); i++) {
					
			%>
			<tr style="background-color: white; height: 25px;">
				<td align="center"><%=i+1 %></td>
				<td align="center"><%=list.get(i).getClassId()%></td>
				<td align="center"><%=list.get(i).getClassName()%></td>
				<td align="center"><%=list.get(i).getClassStatus()%></td>
				<td align="center"><%=list.get(i).getSeatNumber()%></td>
				<td align="center"><%=list.get(i).getJssm()%></td>
				<td align="center">
					<a href="modpark.jsp?id=<%=list.get(i).getClassId()%>"><img src="../img/edit.gif"> </a>
				</td>
				<td align="center">
					<a href="delpark.jsp?id=<%=list.get(i).getClassId()%>" onclick="return confirm('是否删除此教室？(同时此教室的其他信息也将删除)')"> <img src="../img/delimg.gif"> </a>
				</td>
			</tr>
			<%
				}
	}
			%>
			
		</table>
	</div>
</body>
</html>